<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<button id="run">开启网络摄像头</button><Br/>
	<!-- <object type='application/x-vlc-plugin' pluginspage="http://www.videolan.org/" id='vlc' events='false' width="720" height="410">
	    <param name='mrl' value='rtsp://admin:12345asd@192.168.2.5:554/h264/ch1/main/av_stream' />
	    <param name='volume' value='50' />
	    <param name='autoplay' value='true' />
	    <param name='loop' value='false' />
	    <param name='fullscreen' value='false' />
	    <param name='controls' value='false' />
	</object> -->
    <video id="webcam"></video>
    <script type="text/javascript">
		navigator.getUserMedia || (navigator.getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia || navigator.msGetUserMedia);

		if (!navigator.getUserMedia) {
		    alert("您的浏览器不支持");
		}

		var btn = document.getElementById('run');
		btn.onclick = startWebcam;

		function startWebcam(e) {
		    navigator.getUserMedia({
		        video: true,
		        audio: true
		    }, onSuccess, onError);

		    function onSuccess(stream) {

		        var video = document.getElementById('webcam');

		        if (window.URL) {
		            video.src = window.URL.createObjectURL(stream);
		        } else {
		            video.src = stream;
		        }

		        video.autoplay = true;
		    }

		    function onError() {}
		}
		</script>
</body>
</html>